#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    int massage(vector<int>& nums) {
        int n = nums.size();
        if (n == 0)
            return 0;
        vector<int> as(n);
        auto ad = as;
        as[0] = nums[0];
        for (int i = 1; i < n; i++)
        {
            as[i] = ad[i - 1] + nums[i];
            ad[i] = max(as[i - 1], ad[i - 1]);
        }
        return max(as[n - 1], ad[n - 1]);
    }
};